package org.yzh.web.redis;

import io.github.yezhihao.netmc.core.annotation.Endpoint;
import org.springframework.beans.factory.annotation.Autowired;
import org.yzh.web.sever.WebSocket;
import redis.clients.jedis.Jedis;

import java.util.Arrays;
import java.util.List;

//@Configuration
//@PropertySource("classpath:config.properties")
@Endpoint
public class JT808Data {

    @Autowired
    WebSocket webSocket;

    String[] c = {"17006531821","14506128857"};
    String[] car = {"17006531821"};
    // 创建Redis客户端连接
    Jedis jedis = new Jedis("101.34.59.174", 6379);
    String name = "a";

    public void setData(String clinetid, List list){
        boolean contains = Arrays.asList(c).contains(clinetid);
        boolean contains1 = Arrays.asList(car).contains(clinetid);
        if (contains){
            jedis.setex("a", 60 , String.valueOf(list));
        }else if (contains1){
            jedis.setex("3", 60 , String.valueOf(list));
        }
//        String value = jedis.get(name);
//        webSocket.GroupSending(value);
    }


}
